package com.lovo.web.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lovo.web.bean.ProductInfoBean;
import com.lovo.web.mapper.IProductInfoMapper;
import com.lovo.web.service.IProductInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class ProductInfoServiceImpl implements IProductInfoService {

    @Autowired
    private IProductInfoMapper mapper;
    @Override
    public List<ProductInfoBean> findHotProductLst() {
        return mapper.findHotProductLst();
    }

    @Override
    public List<ProductInfoBean> findByName(String productName) {
        QueryWrapper<ProductInfoBean> qw=new QueryWrapper<>();
        qw.eq("pi_productName",productName);
        return mapper.selectList(qw);
    }

    @Override
    public ProductInfoBean findByNameAndSpecs(String Name, String Specs) {
        QueryWrapper<ProductInfoBean> qw=new QueryWrapper<>();
        qw.eq("pi_productName",Name);
        qw.eq("pi_specs",Specs);
        return mapper.selectOne(qw);
    }
}
